package com.vondear.rxui.view.dialog;

import android.app.Activity;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.vondear.rxtool.RxPhotoTool;
import com.vondear.rxui.R;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;


/**
 *
 * @date 2017/3/20
 * 封装了从相册/相机 获取 图片 的Dialog.
 */
public class RxDialogChooseCaiLiaoUpload extends RxDialog {

    private LayoutType mLayoutType = LayoutType.TITLE;
    private TextView tv_pic;
    private TextView tv_vedio;
    private TextView tv_file;
    private TextView tv_cancel;
    private Activity context;

    public RxDialogChooseCaiLiaoUpload(Context context, int themeResId) {
        super(context, themeResId);
        initView();
    }

    public RxDialogChooseCaiLiaoUpload(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        initView();
    }

    public RxDialogChooseCaiLiaoUpload(Context context) {
        super(context);
        initView();
    }

    public RxDialogChooseCaiLiaoUpload(Context context, float alpha, int gravity) {
        super(context, alpha, gravity);
        initView();
    }

    public TextView getTv_pic() {
        return tv_pic;
    }

    public TextView getTv_file() {
        return tv_file;
    }

    public TextView getTv_vedio() {
        return tv_vedio;
    }

    public TextView getTv_cancel() {
        return tv_cancel;
    }

    public void setPicClickListener(View.OnClickListener listener) {
        tv_pic.setOnClickListener(listener);
    }

    public void setVedioClickListener(View.OnClickListener listener) {
        tv_vedio.setOnClickListener(listener);
    }

    public void setFileClickListener(View.OnClickListener listener) {
        tv_file.setOnClickListener(listener);
    }

    private void initView() {
        View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_cailiao_choose, null);
        tv_pic = dialogView.findViewById(R.id.tv_pic);
        tv_vedio = dialogView.findViewById(R.id.tv_vedio);
        tv_file = dialogView.findViewById(R.id.tv_file);
        tv_cancel = dialogView.findViewById(R.id.tv_cancel);
        tv_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        setContentView(dialogView);
        mLayoutParams.gravity = Gravity.BOTTOM;
    }


    public enum LayoutType {
        TITLE, NO_TITLE
    }
}
